<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>自动涮新示例</title>
</head>
<body>
	<div style="margin: auto; width: 80%">
		<h2>JSP自动涮新示例</h2>
		<%
			// Set refresh, autoload time as 2 seconds
			response.setIntHeader("Refresh", 2);

			// Get current time
			Calendar calendar = new GregorianCalendar();
			String am_pm;

			int hour = calendar.get(Calendar.HOUR);
			int minute = calendar.get(Calendar.MINUTE);
			int second = calendar.get(Calendar.SECOND);

			if (calendar.get(Calendar.AM_PM) == 0)
				am_pm = "AM";
			else
				am_pm = "PM";
			String CT = hour + ":" + minute + ":" + second + " " + am_pm;
			out.println("当前时间: " + CT + "\n");
		%>
	</div>
</body>
</html>